// basin.txt
// Cell 0 - Effects of basin
// Cell 1 - modifier, defaults to 90
// Cell 2,3 - A SDF. If 0, basin is usable

// effects
// 0 - bless
// 1 - haste
// 2 - shield
// 3 - essence armor
// 4 - resistant
// 5 - protection aura
// 6 - invlum
// 7 - poison
// 8 - acid
// 9 - summon creature
// 10 - more energy
// 11 - less energy
// 12 - nothing
// 13 - heal
// 14 - experience
// 15 - cure death curse

beginobjectscript;

variables;

short amount = 90;

body;

beginstate INIT_STATE;
	if (get_memory_cell(1) != 0)
		amount = get_memory_cell(1);
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; 
	if (gf(get_memory_cell(2),get_memory_cell(3)) > 0) 
		set_object_icon(ME,18);
		else set_object_icon(ME,20);
break;

beginstate USE_STATE;
	if (gf(get_memory_cell(2),get_memory_cell(3)) > 0) {
		print_str_color("Drink Water: The basin is empty.",2);
		end();
		}
	print_str_color("Drink Water: You drink the water in the basin.",2);
	play_sound(114);
	
	if (get_memory_cell(0) == 0) {
		print_str_color("  You feel energized.",2);
		set_char_status(30000,0,amount);
		}
	if (get_memory_cell(0) == 1) {
		print_str_color("  Everything around you slows down.",2);
		set_char_status(30000,1,amount);
		}
	if (get_memory_cell(0) == 2) {
		print_str_color("  You feel much safer.",2);
		set_char_status(30000,8,amount);
		}
	if (get_memory_cell(0) == 3) {
		print_str_color("  Your skin becomes much tougher.",2);
		if (amount > 10)
			amount = 10;
		set_char_status(30000,11,-100);
		set_char_status(30000,12,amount);
		}
	if (get_memory_cell(0) == 4) {
		print_str_color("  Your skin begins to glow slightly.",2);
		set_char_status(30000,14,amount);
		}
	if (get_memory_cell(0) == 5) {
		print_str_color("  Your skin becomes as tough as lizard hide.",2);
		if (amount > 10)
			amount = 10;
		set_char_status(30000,13,amount);
		}
	if (get_memory_cell(0) == 6) {
		print_str_color("  You begin to feel indestructible.",2);
		if (amount > 25)
			amount = 25;
		set_char_status(30000,18,amount);
		}
	if (get_memory_cell(0) == 7) {
		print_str_color("  You feel sick to your stomach.",2);
		set_char_status(30000,2,amount);
		}
	if (get_memory_cell(0) == 8) {
		print_str_color("  The water turns to acid in your stomach.",2);
		set_char_status(30000,6,amount);
		}
	if (get_memory_cell(0) == 9) {
		print_str_color("  A cloud of mist floats out of the basin. Then it",2);
		print_str_color("  forms a living thing.",2);
		spawn_creature(amount);
		}
	if (get_memory_cell(0) == 10) {
		print_str_color("  Some of your magical energy is restored.",2);
		restore_energy_char(30000,amount);	
		}
	if (get_memory_cell(0) == 11) {
		print_str_color("  Some of your magical energy is drained.",2);
		restore_energy_char(30000,-1 * amount);	
		}
	if (get_memory_cell(0) == 12) {
		print_str_color("  As far as you can tell, nothing happens.",2);
		}
	if (get_memory_cell(0) == 13) {
		print_str_color("  Your wounds are healed.",2);
		heal_char(30000,amount);	
		}
	if (get_memory_cell(0) == 14) {
		print_str_color("  You feel strange. You gain new insight.",2);
		award_party_xp(600,average_level());	
		}
	if (get_memory_cell(0) == 15) {
		print_str_color("  You feel a powerful jolt of life force flowing into you.",2);
		status_nearby(-10,2,26,0);
		status_nearby(5,2,9,0);
		status_nearby(5,2,14,0);
		}
						
	sf(get_memory_cell(2),get_memory_cell(3),1) ;
	set_object_icon(ME,18);
break;